#include<queue>
#include<iostream>
using namespace std;
template<class T>
class Element
{
private:
    int priority;
    T data;
public:
    Element(int p,int a);
    ~Element();
    inline friend bool operator <(const Element<T> &a,const Element<T> &b)//定义关系运算符
    {
        return a.priority<b.priority?true:false;
    }
    void PrintData()const
    {
        cout<<data<<"(pri:"<<priority<<")"<<'\t';
    }
};
template<class T>
Element<T>::Element(int p,int a)
{
    priority=p;
    data=a;
}
template<class T>
Element<T>::~Element()
{

}
int main()
{
    priority_queue<Element<int>> pque;
    pque.push(Element<int>(1,20));
    pque.push(Element<int>(3,30));
    pque.push(  Element<int>(2,40));
    pque.push(Element<int>(3,50));
    pque.push(  Element<int>(5,40));
    pque.push(  Element<int>(4,40));
    int size=(int)pque.size();
    cout<<"size:"<<size<<endl;
    for (int i = 0; i < size; i++)
    {
        pque.top().PrintData();
        pque.pop();
    }
    cout<<endl;
};